<template>
  <form-create-mobile
    v-model="formData"
    v-model:api="fapi"
    :rule="rule"
    :option="option"
    @submit="onSubmit"
  ></form-create-mobile>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import formCreateMobile from '@form-create/vant'
import RuleTest from './test7.json?raw'

const option = ref(
  formCreateMobile.parseJson(
    '{\n' +
      '  "form": {\n' +
      '    "labelWidth": "6.2em",\n' +
      '    "colon": false,\n' +
      '    "labelAlign": "top",\n' +
      '    "inputAlign": "left"\n' +
      '  },\n' +
      '  "resetBtn": {\n' +
      '    "show": false,\n' +
      '    "innerText": "重置"\n' +
      '  },\n' +
      '  "submitBtn": {\n' +
      '    "show": true,\n' +
      '    "innerText": "提交"\n' +
      '  },\n' +
      '  "formName": "A7"\n' +
      '}',
  ),
)
const rule = ref(formCreateMobile.parseJson(RuleTest))
const fapi = ref(null)
const formData = ref({})

const onSubmit = (formData) => {
  //todo 提交表单
}
</script>
